package demo;

/**
 * Created with IntelliJ IDEA.
 * User: 12629
 * Date: 2021/10/30
 * Time: 16:17
 * Description:
 */
public class Test2 {

    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder("abcdef");
        sb.append("123");


        StringBuffer sb3 = new StringBuffer();
        sb3.append("456");


    }


    public static void main6(String[] args) {
        String str = "hello";
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        for(int i = 0;i < 10;i++) {
            sb.append(i);
        }
        System.out.println(sb.toString());
        //"fsdfafs"
    }
    public static void main5(String[] args) {
        String str = "hello";
        for(int i = 0;i < 10;i++) {
            str += i;
        }
        System.out.println(str);
    }

    public static void main4(String[] args) {
        StringBuilder sb = new StringBuilder("abcd");
        sb.append(1).append("dsaf");
        System.out.println(sb);
    }

    public static void main3(String[] args) {
        StringBuilder sb = new StringBuilder();
        /*sb.append("hello");
        sb.append("world");*/
        sb.append("hello").append("world");
        System.out.println(sb);
        //String s = sb.toString();
    }
    public static void main2(String[] args) {
        String str = "hello";

        StringBuilder sb = new StringBuilder();
        sb.append(str);
        sb.append("world");

        str = sb.toString();
        System.out.println(str);
    }
    public static void main1(String[] args) {
        String str = "hello";
        str = str + "world";
        System.out.println(str);
    }
}
